{# **
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://devdocs.prestashop.com/ for more information.
 *
 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 * #}
{% extends '@PrestaShop/Admin/layout.html.twig' %}

{% block stylesheets %}
  {{ parent() }}
  <link rel="stylesheet" href="{{ asset('themes/new-theme/public/product' ~ rtl_suffix ~ '.css') }}" type="text/css" media="all">
{% endblock %}

{# We empty the parent content header block because session alert is gonna be displayed inside the content #}
{% block content_header %}
{% endblock %}

{% block content %}
<div class="product-page-v2">
  {% set productType = productForm.vars.product_type %}
  {% set productId = productForm.vars.product_id %}
  {% set shopId = productForm.vars.shop_id %}
  {# Passed via data attribute only so that the iframe modal can replicate it in its redirection url #}
  {% set forceDefaultActive = productForm.vars.force_default_active %}

  <div class="header-toolbar d-print-none">
    {{ component('MultistoreProductHeader', {productId: productId}) }}
  </div>

  {{ form_start(productForm, {attr: {
    class: 'form-horizontal product-page justify-content-md-center product-form',
    novalidate: 'novalidate',
    'data-product-id': productId,
    'data-shop-id': shopId,
    'data-product-type': productType,
    'data-force-default-active': forceDefaultActive
  }}) }}

  {# Header form child is rendered separately because it's not one of the tabs so it needs to be rendered before #}
  {% block product_header %}
    {{ include('@PrestaShop/Admin/Sell/Catalog/Product/Blocks/header.html.twig', {productForm: productForm}) }}
  {% endblock %}

  {# Footer form child is rendered separately because it's not one of the tabs so it needs to be rendered before #}
  {% block product_footer %}
    {{ include('@PrestaShop/Admin/Sell/Catalog/Product/Blocks/footer.html.twig', {
      productForm: productForm,
      editable: editable,
      productId: productId,
    }) }}
  {% endblock %}

  {{ block('session_alert') }}

  <div id="contextual-notification-box"></div>

  {{ form_widget(productForm) }}

  {% block product_rest %}
    {{ form_end(productForm) }}
  {% endblock %}

  {% block category_tree_form %}
    {{ form_row(categoryTreeSelectorForm) }}
  {% endblock %}
</div>
{% endblock %}

{% block javascripts %}
  {{ parent() }}

  <script src="{{ asset('themes/new-theme/public/product_edit.bundle.js') }}"></script>
{% endblock %}
